package com.wjk.kylin.mall.common.core.constant;

/**
 * 通用常量信息
 * 
 * @author wangjinkui
 */
public class Constants {
    /**
     * 成功返回码
     */
    public static final int SUCCESS = 200;
    /**
     * 初始化密码123456
     */
    public static final String INIT_PASSWORD = "123456";
    //==========================验证码===============================
    /**
     * 验证码 redis key
     */
    public static final String CAPTCHA_CODE_KEY = "kylin-mall:mall-member-captcha-codes:";
    /**
     * 验证码 redis key
     */
    public static final String ADMIN_CAPTCHA_CODE_KEY = "kylin-mall:mall-admin-captcha-codes:";
    /**
     * 验证码有效期（分钟）
     */
    public static final Integer CAPTCHA_EXPIRATION = 3*60;

    //======================token===================================

    public static final String GRANT_TYPE_KEY = "grant_type";
    public static final String REFRESH_TOKEN_KEY = "refresh_token";
    /**
     * 认证方式
     */
    public static final String AUTHENTICATION_METHOD = "authenticationMethod";
    /**
     * 认证请求头key
     */
    public static final String AUTHORIZATION_KEY = "Authorization";
    /**
     * Basic认证前缀
     */
    public static final String BASIC_PREFIX = "Basic ";

//    /**
//     * 授权模式
//     */
//    public static final String GRANT_TYPE = "password";
    /**
     * 后台管理client_id
     */
    public static final String ADMIN_CLIENT_ID = "admin-app";

    /**
     * 前台商城client_id
     */
    public static final String PORTAL_CLIENT_ID = "portal-app";
    /**
     * 小程序端（微信小程序、....） 客户端ID
     */
    public static final String WEB_CLIENT_ID = "web-app";
    /**
     * Token 类型
     */
    public static final String TOKEN_TYPE_BEARER = "Bearer ";
    /**
     * 携带Token的HTTP头
     */
    public static final String TOKEN_HEADER = "Authorization";
    /**
     * Redis缓存权限规则key
     */
    public static final String PERMISSION_ROLES_KEY = "auth:permission:roles";
    /**
     * 黑名单token前缀
     */
    public static String TOKEN_BLACKLIST_PREFIX = "auth:token:blacklist:";

    /**
     * JWT存储权限前缀
     */
    public static String AUTHORITY_PREFIX = "ROLE_";
    /**
     * JWT存储权限属性
     */
    public static String JWT_AUTHORITIES_KEY = "authorities";

    /**
     * JWT载体key
     */
    public static String JWT_PAYLOAD_KEY = "payload";

    /**
     * JWT ID 唯一标识
     */
    public static String JWT_JTI = "jti";

    /**
     * JWT ID 唯一标识
     */
    public static String JWT_EXP = "exp";

    /**
     * 后台管理接口路径匹配
     */
    public static String ADMIN_URL_PATTERN = "/api/admin/**";

    /**
     * 验证token接口路径匹配
     */
//    public static String TOKEN_URL_PATTERN = "/api/**/token/**";

    public static String USER_ID_KEY = "user_id";
    public static String USER_NAME_KEY = "user_name";
    public static String NICK_NAME_KEY = "nick_name";
    public static String CLIENT_ID_KEY = "client_id";

    /**
     * http请求
     */
    public static final String HTTP = "http://";

    /**
     * https请求
     */
    public static final String HTTPS = "https://";
    /** Layout组件标识 */
    public final static String LAYOUT = "Layout";
    /** ParentView组件标识 */
    public final static String PARENT_VIEW = "ParentView";
    /** InnerLink组件标识 */
    public final static String INNER_LINK = "InnerLink";

    //------------------------------------
    public final static String URL_PERM_ROLES_KEY = "system:perm_roles_rule:url:";
    public final static String BTN_PERM_ROLES_KEY = "system:perm_roles_rule:btn:";
    public final static String ROOT_ROLE_CODE = "ROOT";

    /**
     * actuator
     */
    public static String ACTUATOR_URL_PATTERN = "/*/actuator/**";

    /**链路追踪 traceId */
    public static final String TRACE_ID_KEY = "traceId";

    public static final int ES_MAX_PARAMS_NUM = 1024;
    public static final int ES_QUERY_PAGE_SIZE = 2000;

}
